﻿<UserControl x:Class="Deployment.Data.UI.Controls.Task.EditableTaskList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             x:Name="EditorList"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <DockPanel LastChildFill="True">
        <StackPanel DockPanel.Dock="Right" Margin="4,20,4,0">
            <Button Content="Add task"
                            Margin="2"
                            Padding="2"
                            Click="AddTask_Click"/>
            <Button Content="Remove task"
                            Margin="2"
                            Padding="2"
                            Click="RemoveTask_Click">
                <Button.Style>
                    <Style>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=TaskList, Path=SelectedItem}"
                                                 Value="{x:Null}">
                                <Setter Property="Button.IsEnabled" Value="False"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
        <ListView Grid.Row="0" Grid.Column="0"
                  DockPanel.Dock="Left"
                  x:Name="TaskList"
                  VerticalAlignment="Stretch"
                  ClipToBounds="True"
                  ScrollViewer.CanContentScroll="True"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  ItemsSource="{Binding}">
            <ListView.Resources>
                <Style TargetType="{x:Type GridViewColumnHeader}">
                    <Setter Property="HorizontalAlignment"
                                    Value="Left"/>
                </Style>
                
            </ListView.Resources>
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Id"
                                    Width="Auto"
                                    DisplayMemberBinding="{Binding Id}"/>
                    <GridViewColumn Header="Type"
                                    Width="Auto"
                                    DisplayMemberBinding="{Binding TypeDescription}"/>
                    <GridViewColumn Header="Description"
                                    Width="Auto"
                                    DisplayMemberBinding="{Binding Description}"/>
                </GridView>
            </ListView.View>
        </ListView>
    </DockPanel>
</UserControl>
